/**
 * Project Name:HomeActivity
 * Date:2016-6-7上午11:11:32
 * Copyright (c) 2016, askzhao All Rights Reserved.
 *
 */
package com.kkd.kkdapp.activity;

import android.net.Uri;
import android.os.Bundle;
import com.kkd.kkdapp.R;
import com.kkd.kkdapp.base.BaseActivity;
import com.kkd.kkdapp.db.app.model.PdfUrlModel;
import com.kkd.kkdapp.http.manager.DownFileManager;
import com.kkd.kkdapp.http.manager.DownFileManager.DownLoadCallback;
import com.kkd.kkdapp.utils.FileUtils;
import com.kkd.kkdapp.utils.MD5;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;

import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.Toast;

/**
 * ClassName: PdfReaderActivity <br/>
 * date: 2016-6-7 上午11:11:32 <br/>
 * 
 * @author askzhao
 * @version
 */
public class PdfReaderActivity extends BaseActivity {

	private WebView webView;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.pdf_read_activity);
		webView = (WebView) findViewById(R.id.webView);
		
	}
	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
		Intent intent = getIntent();
		Uri uri = intent.getData();
		String path = uri.toString();
		if(!TextUtils.isEmpty(path)){
			String url = PdfUrlModel.queryUrlByFileMd5(MD5.Md5File(path));
			if(!TextUtils.isEmpty(url)){
				webView.loadUrl(url);
			}
		}else{
			finish();
		}
		
		
	}

}
